/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-08-17
 * Time: 16:22
 */
public class Test85 {
    public static int rob(int[] num) {
        int n = num.length;
        int[][] dp = new int[n][2];
        dp[0][0] = num[0];
        dp[0][1] = 1;
        // dp[i][0] 第i天偷 dp[i][1] 第i天不偷
        for(int i = 1; i < n; i++) {
            dp[i][0] = dp[i-1][1]+num[i];
            dp[i][1] = Math.max(dp[i-1][0],dp[i-1][1]);
        }
        return Math.max(dp[n-1][0],dp[n-1][1]);
    }


    public static void main(String[] args) {
        int[] num = {1,2,3,1};
        int ret = rob(num);
        System.out.println(ret);
    }

}
